﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manageweb_ManageGuestOrder_ManageGuestOrder : System.Web.UI.Page
{
    MODEL.GuestOrder MGO = new MODEL.GuestOrder();
    MODEL.GuestOrder _MGO = new MODEL.GuestOrder();

    BLL.GuestOrder BGO = new BLL.GuestOrder();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["MasterID"] == null)
        {
            Response.Redirect("../Default.aspx");
        }

        TABLE_Detail.Visible = false;
    }


    #region 查看详细表格数据初始化
    protected void PageDataInit()
    {
        try
        {
            MGO.GO_ID = Convert.ToInt32(LB_ID.Text);

            _MGO = BGO.GetDataByID(MGO);

            LB_Content.Text = _MGO.GO_Content;
            LB_Email.Text = _MGO.GO_Email;
            LB_ItemNumber.Text = _MGO.GO_ItemNumber;
            LB_Name.Text = _MGO.GO_Name;
            LB_Tel.Text = _MGO.GO_Tel;
            LB_Title.Text = _MGO.GO_Title;
            LB_IP.Text = _MGO.GO_IP;
        }
        catch (Exception ex)
        {
            LB_ManageGuestOrder.Text = ex.Message;
        }
    }
    #endregion


    #region 查看订单 [Command] [GridView]
    protected void LBtn_View_Command(object sender, CommandEventArgs e)
    {
        try
        {
            TABLE_Detail.Visible = true;

            LB_ID.Text = e.CommandArgument.ToString();

            PageDataInit();
        }
        catch (Exception ex)
        {
            LB_ManageGuestOrder.Text = ex.Message;
        }
    }
    #endregion
    #region 修改订单 [Command] [GridView]
    protected void LBtn_Del_Command(object sender, CommandEventArgs e)
    {
        try
        {
            MGO.GO_ID = Convert.ToInt32(e.CommandArgument);

            BGO.Del(MGO);

            LB_ManageGuestOrder.Text = "删除成功";

            GV_OrderList.DataBind();
        }
        catch (Exception ex)
        {
            LB_ManageGuestOrder.Text = ex.Message;
        }
    }
    #endregion
}
